feat(api): expose sampler_mode and 4 DiT params on /release_task HTTP API#1092
feat(api): expose sampler_mode and 4 DiT params on /release_task HTTP API#1092FlexOr2 wants to merge 2 commits intoace-step:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughFive new diffusion and latent-control request parameters—sampler_mode, velocity_norm_threshold, velocity_ema_factor, latent_shift, latent_rescale—were added and propagated through API models, parameter parsing (with camelCase aliases), request building, and job generation setup with defaults. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant HTTP as HTTP API Model
participant Parser as RequestParser
participant Builder as RequestBuilder
participant Setup as JobGenerationSetup
participant Params as GenerationParams
Client->>HTTP: send request (samplerMode / sampler_mode, latentShift, ...)
HTTP->>Parser: parse params (resolve camelCase & snake_case)
Parser->>Builder: provide canonical params
Builder->>Setup: build request object (includes sampler_mode, latent_shift, ...)
Setup->>Params: construct GenerationParams with defaults or provided values
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… API Five GenerationParams fields that were only accessible via Gradio's direct Python path are now accepted by the /release_task HTTP endpoint: - sampler_mode: "euler" (default) or "heun" sampler selection - velocity_norm_threshold: velocity prediction norm clamping (0=off) - velocity_ema_factor: velocity EMA smoothing (0=off) - latent_shift: additive shift on DiT latents before VAE decode - latent_rescale: multiplicative rescale on DiT latents before VAE decode All five already exist on the internal GenerationParams dataclass and are wired through the diffusion loop. This change adds them to: - GenerateMusicRequest (Pydantic request model) - PARAM_ALIASES (camelCase alias support) - build_generate_music_request (request builder) - build_generation_setup (GenerationParams wiring) Tests added for alias resolution, request builder forwarding, and generation setup wiring (including getattr fallback for older callers). Default values match the existing GenerationParams defaults, so omitting them preserves current behavior. Non-target code paths (Gradio UI, training, CLI) are unchanged.
a7dcb11 to
56dc85f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@acestep/api/http/release_task_param_parser_test.py`:
- Around line 68-77: The test test_sampler_and_dit_param_aliases_are_resolved is
missing assertions for two newly exposed aliases; update the test to also
provide camelCase keys "velocityEmaFactor" and "latentRescale" in the
RequestParser input and add assertions that parser.float("velocity_ema_factor")
equals the provided value (e.g., 0.95) and parser.float("latent_rescale") equals
the provided value (e.g., 1.2), keeping the existing pattern of using
RequestParser and its .float/.str accessors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 31cb3362-7e26-4801-9d7b-2acf89cd833a
📒 Files selected for processing (7)
acestep/api/http/release_task_models.pyacestep/api/http/release_task_param_parser.pyacestep/api/http/release_task_param_parser_test.pyacestep/api/http/release_task_request_builder.pyacestep/api/http/release_task_request_builder_test.pyacestep/api/job_generation_setup.pyacestep/api/job_generation_setup_test.py
✅ Files skipped from review due to trivial changes (3)
- acestep/api/http/release_task_request_builder_test.py
- acestep/api/http/release_task_models.py
- acestep/api/http/release_task_param_parser.py
🚧 Files skipped from review as they are similar to previous changes (2)
- acestep/api/http/release_task_request_builder.py
- acestep/api/job_generation_setup.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The two APG guidance knobs exposed here (`eta` and `momentum`) were already plumbed through GenerationParams and the DiT model stack in the previous commit, but could not be set from the HTTP surface. This change wires them into the /release_task request path, mirroring how PR ace-step#1092 exposed sampler_mode and the four DiT latent params: - GenerateMusicRequest: new `eta: float = 0.0` and `momentum: float = -0.75` fields (defaults match apg_guidance.py hardcoded values). - PARAM_ALIASES: identity aliases for `eta` and `momentum` (both names are single lowercase words, so snake_case == camelCase). - build_generate_music_request: forwards parsed values into the Pydantic request model. - build_generation_setup: uses `getattr(req, ...)` with the same defaults, matching the existing sampler_mode/latent_shift pattern so older callers that don't set these fields still work. The _FakeParser helper in release_task_request_builder_test.py gained a `default=None` parameter on `.get()` to match the real parser's contract — this was a pre-existing mismatch that broke several unrelated tests; fixing it here lets the full builder suite run green. Tests added alongside the changes cover: - alias resolution for `eta` and `momentum` (flat body + nested param_obj), - default values on the Pydantic model, - request-builder forwarding and default-fallback behavior, - generation-setup forwarding into GenerationParams, - the getattr-default path when a request object lacks the fields. All new fields are optional with defaults matching the pre-existing hardcoded APG values; omitting them preserves current HTTP behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
GenerationParamsfields on the/release_taskHTTP endpointParameters added
sampler_mode"euler""euler"or"heun"samplervelocity_norm_threshold0.0velocity_ema_factor0.0latent_shift0.0latent_rescale1.0Scope
acestep/api/http/release_task_models.py— add fields toGenerateMusicRequestacestep/api/http/release_task_param_parser.py— add camelCase aliasesacestep/api/http/release_task_request_builder.py— wire through builderacestep/api/job_generation_setup.py— pass toGenerationParamsRisk and Compatibility
GenerationParamsdefaults. Omitting them preserves current behavior.generate_music()directly; this change only affects the HTTP API surface.getattr()with defaults injob_generation_setup.pyensures older request objects (without the new fields) still work.Why
External clients using the HTTP API (e.g., custom UIs, automation scripts) cannot currently control the sampler mode or latent post-processing params. The Gradio UI bypasses the HTTP API entirely (calling Python directly), so these params work there but not via
/release_task. This creates a capability gap between Gradio and HTTP API users.Regression Checks
PARAM_ALIASESentries follow existing camelCase conventionrelease_task_param_parser_test.pytests unaffected (no existing test touches these new fields)Summary by CodeRabbit
New Features
Tests